<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./vue.js"></script>
    <style>
        .box{
            width: 100px;
            height: 100px;
            background: red;
        }
    </style>
</head>
<body>
    <div class="app">
        <button  @click="fn();idd=!idd">点击{{idd?'A':'B'}}</button>
        <div class="box" ref="box"></div>
    </div>
    <script>
        const vm=new Vue({
            el:'.app',
            data:{
                idd:true,
            },
            methods:{
                fn(){
                    // this.idd=!this.idd;
                    console.log(this.$refs.box)
                }
            }
        })
    </script>
</body>
</html>